//2009/07/27 11:16:19
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

class BigBurger
{
public:
    int maxWait(vector <int> arrival, vector <int> service)
    {
		int score = 0;
		int time = arrival[0] + service[0];
		for(int i=1; i<arrival.size(); i++)
		{
			if(arrival[i] < time)
			{
				score = max(score, time - arrival[i]);
				time += service[i];
			}
			else
			{
				time = arrival[i] + service[i];
			}
		}
		return score;
    }
};
//It's boring.
